.class public final Ljavax/microedition/media/Manager;
.super Ljava/lang/Object;
.source "Manager.java"


# static fields
.field public static final TONE_DEVICE_LOCATOR:Ljava/lang/String; = "device://tone"

.field private static final pcTone:Lorg/microemu/midp/media/audio/PCTone;

.field static vMedia:Ljava/util/Vector;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 40
    const/4 v0, 0x0

    sput-object v0, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    .line 94
    new-instance v0, Lorg/microemu/midp/media/audio/PCTone;

    invoke-direct {v0}, Lorg/microemu/midp/media/audio/PCTone;-><init>()V

    sput-object v0, Ljavax/microedition/media/Manager;->pcTone:Lorg/microemu/midp/media/audio/PCTone;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 36
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method static cleanupMedia()V
    .locals 4

    .prologue
    .line 120
    :goto_0
    :try_start_0
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    if-eqz v2, :cond_0

    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    invoke-virtual {v2}, Ljava/util/Vector;->size()I

    move-result v2

    if-lez v2, :cond_0

    .line 122
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Ljava/util/Vector;->elementAt(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljavax/microedition/media/Player;

    .line 123
    .local v1, play:Ljavax/microedition/media/Player;
    invoke-interface {v1}, Ljavax/microedition/media/Player;->close()V

    .line 124
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Ljava/util/Vector;->removeElementAt(I)V
    :try_end_0
    .catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 127
    .end local v1           #play:Ljavax/microedition/media/Player;
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 128
    :cond_0
    return-void
.end method

.method public static createPlayer(Ljava/io/InputStream;Ljava/lang/String;)Ljavax/microedition/media/Player;
    .locals 3
    .parameter "stream"
    .parameter "type"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljavax/microedition/media/MediaException;
        }
    .end annotation

    .prologue
    .line 68
    const-string v2, "audio/x-wav"

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_0

    const-string v2, "audio/basic"

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_0

    const-string v2, "audio/mpeg"

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2

    .line 71
    :cond_0
    new-instance v0, Ljavax/microedition/media/SampledAudioPlayer;

    invoke-direct {v0}, Ljavax/microedition/media/SampledAudioPlayer;-><init>()V

    .line 72
    .local v0, audPlayer:Ljavax/microedition/media/SampledAudioPlayer;
    invoke-virtual {v0, p0, p1}, Ljavax/microedition/media/SampledAudioPlayer;->open(Ljava/io/InputStream;Ljava/lang/String;)Z

    .line 74
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    if-nez v2, :cond_1

    .line 75
    new-instance v2, Ljava/util/Vector;

    invoke-direct {v2}, Ljava/util/Vector;-><init>()V

    sput-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    .line 76
    :cond_1
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    invoke-virtual {v2, v0}, Ljava/util/Vector;->add(Ljava/lang/Object;)Z

    move-object v2, v0

    .line 90
    .end local v0           #audPlayer:Ljavax/microedition/media/SampledAudioPlayer;
    :goto_0
    return-object v2

    .line 79
    :cond_2
    const-string v2, "audio/midi"

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_4

    .line 81
    new-instance v1, Ljavax/microedition/media/MidiAudioPlayer;

    invoke-direct {v1}, Ljavax/microedition/media/MidiAudioPlayer;-><init>()V

    .line 82
    .local v1, midiPlayer:Ljavax/microedition/media/MidiAudioPlayer;
    invoke-virtual {v1, p0, p1}, Ljavax/microedition/media/MidiAudioPlayer;->open(Ljava/io/InputStream;Ljava/lang/String;)Z

    .line 84
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    if-nez v2, :cond_3

    .line 85
    new-instance v2, Ljava/util/Vector;

    invoke-direct {v2}, Ljava/util/Vector;-><init>()V

    sput-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    .line 86
    :cond_3
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    invoke-virtual {v2, v1}, Ljava/util/Vector;->add(Ljava/lang/Object;)Z

    move-object v2, v1

    .line 87
    goto :goto_0

    .line 90
    .end local v1           #midiPlayer:Ljavax/microedition/media/MidiAudioPlayer;
    :cond_4
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public static createPlayer(Ljava/lang/String;)Ljavax/microedition/media/Player;
    .locals 1
    .parameter "locator"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljavax/microedition/media/MediaException;
        }
    .end annotation

    .prologue
    .line 60
    const/4 v0, 0x0

    return-object v0
.end method

.method public static getSupportedContentTypes(Ljava/lang/String;)[Ljava/lang/String;
    .locals 1
    .parameter "protocol"

    .prologue
    .line 45
    const/4 v0, 0x0

    new-array v0, v0, [Ljava/lang/String;

    return-object v0
.end method

.method public static getSupportedProtocols(Ljava/lang/String;)[Ljava/lang/String;
    .locals 1
    .parameter "content_type"

    .prologue
    .line 52
    const/4 v0, 0x0

    new-array v0, v0, [Ljava/lang/String;

    return-object v0
.end method

.method static mediaDone(Ljava/lang/Object;)V
    .locals 3
    .parameter "objMedia"

    .prologue
    .line 107
    const/4 v1, 0x0

    .local v1, index:I
    :goto_0
    :try_start_0
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    if-eqz v2, :cond_1

    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    invoke-virtual {v2}, Ljava/util/Vector;->size()I

    move-result v2

    if-ge v1, v2, :cond_1

    .line 109
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    invoke-virtual {v2, v1}, Ljava/util/Vector;->elementAt(I)Ljava/lang/Object;

    move-result-object v2

    if-ne p0, v2, :cond_0

    .line 110
    sget-object v2, Ljavax/microedition/media/Manager;->vMedia:Ljava/util/Vector;

    invoke-virtual {v2, v1}, Ljava/util/Vector;->removeElementAt(I)V
    :try_end_0
    .catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_0

    .line 107
    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 113
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 114
    :cond_1
    return-void
.end method

.method public static declared-synchronized playTone(III)V
    .locals 8
    .parameter "frequency"
    .parameter "time"
    .parameter "volume"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/media/MediaException;
        }
    .end annotation

    .prologue
    .line 99
    const-class v7, Ljavax/microedition/media/Manager;

    monitor-enter v7

    :try_start_0
    sget-object v0, Ljavax/microedition/media/Manager;->pcTone:Lorg/microemu/midp/media/audio/PCTone;

    int-to-double v1, p0

    int-to-double v3, p1

    int-to-double v5, p2

    invoke-virtual/range {v0 .. v6}, Lorg/microemu/midp/media/audio/PCTone;->play(DDD)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 100
    monitor-exit v7

    return-void

    .line 99
    :catchall_0
    move-exception v0

    monitor-exit v7

    throw v0
.end method
